<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="css/Shopping_Cart.css">
		<link rel="stylesheet" href="css/reset.css">
	</head>
	<body>
		<div class="my_root">
			<!-- 头部 -->
			<div class="sign_header">
				<div class="header_center">
					<!-- 头左 -->
					<div class="header_left">
						<ul class="header_ul">
							<li><a href="index.html" class="first_a">母婴之家</a></li>
							<li class="li_hover"><a href="javascript:;" class="border_li">我要开店</a></li>
							<li class="li_hover li_padding">
								<i class="phone_ic"></i>
								<a href="javascript:;" class="border_li">手机版</a>
							</li>
						</ul>
					</div>
					<!-- 头右 -->
					<div class="header_right">
						<ul>
							<li class="right_li">
								<span>欢迎来到母婴之家！</span>
								&nbsp;
								<a href="Sign.html">[登录]</a>
								&nbsp;
								<a href="register.html">[免费注册]</a></li>
							<li class="right_line"></li>
							<li>
								<a href="">我的订单</a>
								<i></i>
							</li>
							<li class="right_line"></li>
							<li>
								<a href="">客服服务</a>
								<i></i>
							</li>
							<li class="right_line"></li>
							<li>
								<a href="">商务合作</a>
							</li>
							<li class="right_line"></li>
							<li>
								<a href="">网站导航</a>
								<i></i>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<!-- logn部分 -->
			<div class="logonew">
				<div class="logonew_center">
					<div class="logo_left">
						<h1>
							<a href="javascript:;">
								<img src="images/logonew.png" alt="">
							</a>
						</h1>
					</div>
					<div class="step"></div>
				</div>
			</div>
			<!-- 我的购物车 -->
			<div class="my_shopp">
				<div class="my_shopp_center">
					<div class="my_shopp_left">
						<h2>我的购物车</h2>
					</div>
					<div class="my_shopp_right">
						<span>立即
						<a href="javascript:;">[登录]</a>
						，可将商品永久保存在购物车中
						</span>
					</div>
				</div>
				<div class="my_shopp_img">
					<dl>
						<dt>
							<i></i>
						</dt>
						<dd>
							<p class="p_text">您的购物车还是空的</p>
							<p class="p_btn">
								<a href="index.html">去逛逛</a>
							</p>
						</dd>
					</dl>
				</div>
				<div class="my_shopp_car">
					<div class="my_shopp_bor">
						<div class="my_shopp_top">
							<div class="my_shopp_top_left">
								<span class="inblock span_margin">
									<a href="javascript:;" class="label">母婴之家商城</a>
								</span>
								<span class="inblock span_class">
									<span class="ct-t">母婴之家商城购物车</span>
								</span>
							</div>
								<span class="price span_class">单价（元）</span>
								<span class="num span_class">数量（件）</span>
								<span class="span_width_90 span_class">小计（元）</span>
								<span class="action span_class">操作</span>
						</div>
						<ul class="cart3_list">
							<!-- <li class="cart3_prod select item_group ">
								<a href="javascript:;" class="pic inblock">
									<img src="images/155726_01.jpg" alt="">
								</a>
								<span class="tit inblock_1">
									<a href="javascript:;">迪士尼宝宝小画家舒棉绒分腿睡袋80蓝色</a>
								</span>
								<span class="prices inblock_1">
									<ins>¥139.00</ins>
									<br>
									<ins class="del grey">¥448.00</ins>
								</span>
								<span class="nums inblock_1">
									<a href="javascrip:;">
										<span></span>
									</a>
									<input type="text" class="inblock_1" value="1">
									<a href="javascript:;" class="add">
										<span></span>
										<em></em>
									</a>
								</span>
								<span class="inblock_1 count">
									<strong>￥139.00</strong>
								</span>
								<span class="actions inblock_1">
									<a href="javascript:;">删除</a>
								</span>
							</li> -->
						</ul>
					</div>
				</div>
			</div>
			
			<!-- 底部 -->
			<div class="footer">
				<ul class="footer_ul">
					<li><a href="javascript:;">首页</a></li>
						|
					<li><a href="javascript:;">公司简介</a></li>
						|
					<li><a href="javascript:;">人才招聘</a></li>
						|
					<li><a href="javascript:;">合作联系</a></li>
						|
					<li><a href="javascript:;">企业理念</a></li>
						|
					<li><a href="javascript:;">隐私条款</a></li>
				</ul>
					<div class="foot_p">
						<span>由本网站发布的商品或服务的商业宣传活动均属“广告”</br></span>
						<span>Copyright©2003 - 2017 上海母婴之家网络科技股份有限公司 muyingzhijia.com All Rights Reserved 客服热线：021-51760000 4008201000 </br></span>
					</div>
					<div class="foot_last">
						<a href="javascript:;">
							<img src="images/shanghai_industry.gif" alt="">
						</a>
						<a href="javascript:;">
							<img src="images/brand_bottom_large.jpg" alt="">
						</a>
					</div>
					<div class="foot_end">
						<a href="javascript:;"><span>沪ICP备09021709号</span></a>
						<a href="javascript:;"><img src="images/ghs.png" alt=""><span>沪公网安备 31010402000751号</span></a>
					</div>
				</div>
		</div>
		
		<script src="js/common.js"></script>
		<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
		<script src="js/Shopping_Cart.js"></script>
		<script src="js/cookie.js"></script>
		<script>
			var id = getCookie("token");
			var pid = getSearch("pid")
			$.ajax({
				url:"http://jx.xuzhixiang.top/ap/api/cart-list.php",
				type:"get",
				data:{
					"id":id
				},
				success:function(res){
					var obj = JSON.parse(res);
					var html = "";
					for(var i=0;i<obj.data.length;i++){
						html += `
							<li class="cart3_prod select item_group ">
								<a href="javascript:;" class="pic inblock">
									<img src="${obj.data[i].pimg}" alt="">
								</a>
								<span class="tit inblock_1">
									<a href="javascript:;">${obj.data[i].pname}</a>
								</span>
								<span class="prices inblock_1">
									<ins>￥${obj.data[i].pprice}</ins>
									<br>
									<ins class="del grey">¥448.00</ins>
								</span>
								<span class="nums inblock_1">
									<a href="javascrip:;">
										<span></span>
									</a>
									<input type="text" class="inblock_1" value="${obj.data[i].pnum}">
									<a href="javascript:;" class="add">
										<span></span>
										<em></em>
									</a>
								</span>
								<span class="inblock_1 count">
									<strong>￥${obj.data[i].pprice}</strong>
								</span>
								<span class="actions inblock_1">
									<a href="javascript:;" class="delete" data-delete="${obj.data[i].pid}">删除</a>
								</span>
							</li>
						`
					}
					$(".cart3_list").html(html);
					
					$(".delete").click(function(){
						var pid = $(this).data("delete");
						$(this).parent().parent().remove();
						$.ajax({
							url:"http://jx.xuzhixiang.top/ap/api/cart-delete.php",
							type:"get",
							data:{
									"uid":id
									,"pid":pid
								},
							success:function(res){
								var obj = JSON.parse(res);
								console.log(obj)
								
							}
						})
					})
				}
			})
		</script>
	</body>
</html>
